#ifndef xpack_utils_init_item_recursively
#define xpack_utils_init_item_recursively
#pragma push_macro("xuser")
#undef  xuser
#define xuser mixc::utils_init_item_recursively::inc
#include"define/base_type.hpp"
#include"macro/xforward.hpp"
#include"macro/xnew.hpp"
#pragma pop_macro("xuser")

namespace mixc::utils_init_item_recursively::origin{
    template<uxx i_v, class item_t>
    inline void init_item_recursively_core(item_t *){}

    template<uxx i_v, class item_t, class forward_item_t, class ... args_t>
    inline void init_item_recursively_core(item_t * mem, forward_item_t && first, args_t && ... list){
        xnew(mem + i_v) item_t(xforward(first));
        init_item_recursively_core<i_v + 1>(mem, xforward(list)...);
    }
}

namespace mixc::utils_init_item_recursively::origin{
    template<class item_t, class forward_item_t, class ... args_t>
    inline void init_item_recursively(item_t * mem, forward_item_t && first, args_t && ... list){
        init_item_recursively_core<0>(mem, xforward(first), xforward(list)...);
    }
}

#endif

xexport_space(mixc::utils_init_item_recursively::origin)